//
//  BBBaseViewController.m
//  BBRSH
//
//  Created by 陈惠华 on 2017/10/23.
//  Copyright © 2017年 林明达. All rights reserved.
//

#import "BBBaseViewController.h"
//#import "BBLoginViewController.h"
@interface BBBaseViewController ()<UIGestureRecognizerDelegate>

@end

@implementation BBBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor colorWithHexStr:@"#ffffff"];
//    self.navigationController.navigationBar.translucent = NO;
//    self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexStr:@"#053979"];
//    [self.navigationController.navigationBar setTitleTextAttributes:
//
//     @{NSFontAttributeName:[UIFont systemFontOfSize:20],
//
//       NSForegroundColorAttributeName:[UIColor colorWithHexStr:@"#ffffff"]}];

//    [self.leftBtn setBackgroundImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
    [self setNavLeftBtn:nil Image: [UIImage imageNamed:@"back"]];
}

- (void)setNavLeftBtn:(NSString *)btnTitle Image:(UIImage *)image
{
    self.leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 15, 15)];
//    [self.leftBtn setTitle:btnTitle forState:(UIControlStateNormal)];
    self.leftBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.leftBtn setBackgroundImage:image forState:(UIControlStateNormal)];
    [self.leftBtn addTarget:self action:@selector(leftWay) forControlEvents:(UIControlEventTouchUpInside)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.leftBtn];
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];

    //全频幕手势返回
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
    {
        if ([self.navigationController.viewControllers count] > 1)
        {
            self.navigationController.interactivePopGestureRecognizer.enabled = YES;
            self.navigationController.interactivePopGestureRecognizer.delegate = self;
        }
        else
        {
            self.navigationController.interactivePopGestureRecognizer.enabled = NO;
            self.navigationController.interactivePopGestureRecognizer.delegate = nil;
        }
    }
}
- (void)leftWay
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)rightWay
{

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
